﻿namespace Homework01
{
    internal class Program
    {
        /// <summary>
        /// 用户输入一个分数，根据分数，分别给出A B C D
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //get input from keyboard
            Console.Write("请输入学生的成绩：");
            char Grade;
            string? userInput = Console.ReadLine();

            //convert the input into the integer
            int Score;
            if (int.TryParse(userInput, out Score))
            {
                //convert success
                //according with the integer,give the answer
                if (Score >= 90)
                {
                    Grade = 'A';
                }
                else if (Score >= 80)
                {
                    Grade = 'B';
                }
                else if (Score >= 70)
                {
                    Grade = 'C';
                }
                else if (Score >= 60)
                {
                    Grade = 'D';
                }
                else
                {
                    Grade = 'F';
                }

                //output the result
                Console.WriteLine("学生的成绩是：" + Grade);
            }
            else
            {
                //invalid input
                Console.WriteLine("输入数据错误");
            }
        }
    }
}
